<% ' ReadFile(ByVal vsPathName As String) As String ' output: file contents as string ' "" Failure ' WriteFile(ByVal vsPathName As String, ByVal vsFileBuff As String) As Integer ' output: >=0 Bytes written ' -1 Failure ' ' ' This file is provided as part of ASP Power Widgets Samples ' ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT ' WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, ' INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES ' OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR ' PURPOSE. ' Sample Operation: ' Pick up a file in virtual directory of "/", read it and write it to a new file demo.bin ' Copyright 1997-1998. All rights reserved. ' Dalun Software Inc. ASPPW 1.1 ' http://www.dalun.com ' http://members.tripod.com/ActiveServerPage/ sDirName = Server.MapPath("/") response.write "

Pick up a file in directory """ & sDirName & """ .

" Set oFDMgt = Server.CreateObject("ASPPW.FDMgt") if oFDMgt.ReadDir(sDirName)= -1 then response.write "Read Directory Action Failed.
" response.write oFDMgt.GetLastErrDescription else Set oFilelist = ofdmgt.Files if oFilelist.count =0 then response.write "Demo cann't proceed since there is no file in " & sDirName & "." else set file=oFilelist.Item(1) response.write "" & file.Name & "
" buff = ofdmgt.ReadFile(sDirName & "\" & file.Name ) if buff="" and oFDMgt.GetLastErrNum <> 0 then response.write "
Error: " & oFDMgt.GetLastErrDescription else response.write "
" & server.htmlencode(buff) & "
" j = ofdmgt.writeFile(sDirName & "\" & "demo.bin" , buff) response.write cstr(j) & " bytes written to " & sDirName & "\" & "demo.bin.
" end if end if Set oFilelist =nothing end if Set oFDMgt = nothing %>